import http from '@/libs/http'

/**
 * 获取用户基本信息
 * @param {用户微信OPENID} openid 
 */
export function getUserInfo(openid) {
    return http({
        url: '/mall/user/findByOpenId/'+openid,
        method: 'get'
    })
}

/**
 * 绑定手机号
 * @param {*} data {openid, mobile}
 */
export function bandingMobile(data) {
    return http({
        url: '/mall/user/bandingMobile',
        method: 'post',
        data
    })
}

/**
 * 获取短信验证码
 * @param {*} params {mobile}
 */
export function sendSMSValidCode(query) {
    return http({
        url: '/mall/user/sendSMSValidCode',
        method: 'get',
        params: query
    })
}

/**
 * 验证短信验证码是否正确
 * @param {*} data {mobile, smsCode}
 */
export function checkSMSValidCode(data) {
    return http({
        url: '/mall/user/checkSMSValidCode',
        method: 'get',
        params: data
    })
}


/**
 * 检查手机号是否存在
 * @param {*} params {mobile}
 */
export function existMobile(params) {
    return http({
        url: '/mall/user/existMobile',
        method: 'get',
        params
    })
}